<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<script language="JavaScript" type="text/JavaScript">

    function HandleOnClose() {
        var close = confirm("确定离开？");
        if ( close) {
            window.open("sssss.html");
            alert("true")
            return true;
        }
        else
        {
            alert("false")
            return false;
        }
    }

</script>
<body>

    <input type="button" onclick="HandleOnClose()" value="点击">
</body>
</html>